package com.optimize01;

import com.optimize01.child.DecoyDuck;
import com.optimize01.child.RedheadDuck;
import com.optimize01.father.Duck;
import com.optimize01.service.impl.*;
import com.optimize01.child.MallardDuck;
import com.optimize01.child.RubberDuck;

/**
 * 迷你鸭模拟器
 * @Author
 * @Create 2021/2/2
 */
public class MiniDuckSimulator {

    public static void main(String[] args) {
        Duck mallardDuck = new MallardDuck();

        mallardDuck.display();
        mallardDuck.setFlyBehavior(new FlyWithWings());
        mallardDuck.performFly();
        mallardDuck.setQuackBehavior(new Squeak());
        mallardDuck.performQuack();
        mallardDuck.swim();

        System.out.println("------------- 分割线 -------------");

        Duck rubberDuck = new RubberDuck();
        rubberDuck.display();
        rubberDuck.setFlyBehavior(new FlyNoWay());
        rubberDuck.performFly();
        rubberDuck.setQuackBehavior(new MuteQuack());
        rubberDuck.performQuack();
        rubberDuck.swim();

        System.out.println("------------- 分割线 -------------");

        Duck decoyDuck = new DecoyDuck();
        decoyDuck.display();
        decoyDuck.setFlyBehavior(new FlyWithWings());
        decoyDuck.performFly();
        decoyDuck.setQuackBehavior(new Quack());
        decoyDuck.performQuack();
        decoyDuck.swim();

        System.out.println("------------- 分割线 -------------");

        Duck redheadDuck = new RedheadDuck();
        redheadDuck.display();
        redheadDuck.setFlyBehavior(new FlyWithWings());
        redheadDuck.performFly();
        redheadDuck.setQuackBehavior(new Quack());
        redheadDuck.performQuack();
        redheadDuck.swim();
    }
}
